

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[spAccident_InsertAccident]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [dbo].[spAccident_InsertAccident]
GO

GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Eric Liew
-- Create date: 6/2/2009
-- Description:	Insert a Plate
-- =============================================
CREATE PROCEDURE [dbo].[spAccident_InsertAccident]
(
	@AccidentDate DATETIME,
	@DriverId Int,
	@TaxiId INT,
	@Comments Varchar(5000),
	@Location Varchar(500),
	@Fault Varchar(50),
	@Damages Varchar(5000),
	@Costs Varchar(50),
	@RepairedLocation Varchar(200)
)

AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

	INSERT Accident
	(
		AccidentDate,
		DriverId,
		TaxiId,
		Comments,
		Location,
		Fault,
		Damages,
		Costs,
		RepairedLocation
	)
	VALUES
	(
		@AccidentDate,
		@DriverId,
		@TaxiId,
		@Comments,
		@Location,
		@Fault,
		@Damages,
		@Costs,
		@RepairedLocation
	) 	
	
	RETURN @@IDENTITY 
  

END
GO
